package com.atmaowei.controller;

import com.atmaowei.common.Result;
import com.atmaowei.service.ChartService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@CrossOrigin
@RestController
@RequestMapping("/chart")
public class ChartController {

    @Autowired
    private ChartService chartService;

    @GetMapping("/getNumOfMale")
    public Result getNumOfMale() {
        return Result.success(chartService.getNumOfMale());
    }

    @GetMapping("/getNumOfFemale")
    public Result getNumOfFemale() {
        return Result.success(chartService.getNumOfFemale());
    }

    @GetMapping("/getNumOfAge")
    public Result getNumOfAge() {
        return Result.success(chartService.getNumOfAge());
    }

    @GetMapping("/getAllDepartment")
    public Result getAllDepartment() {
        return Result.success(chartService.getAllDepartment());
    }

    @PostMapping("/getNumOfDepartment")
    public Result getNumOfDepartment() {
        return Result.success(chartService.getNumOfDepartment());
    }

    @GetMapping("/getTotal/{name}")
    public Result getTotal(@PathVariable String name) {
        return Result.success(chartService.getTotal(name));
    }
}
